<%-- 
    Document   : createRoom
    Created on : Apr 14, 2011, 11:20:41 AM
    Author     : Revolutors Styx
--%>

<%@page language="java" import="chat.*" contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title></title>
    </head>
    <body>
        <%
        ChatRoomList roomList = (ChatRoomList)application.getAttribute("roomList");
        /*
        *get the room selected
        */
        int chatRoomNumber;
        String desiredRoomName;
        String desiredRoomDescr;
        /*get room number from user session*/
        application.setAttribute("globalRoomCounter",(Integer.parseInt(application.getAttribute("globalRoomCounter").toString()))+1);
        chatRoomNumber = (Integer)application.getAttribute("globalRoomCounter");
        //get the name of the room desired to create
        desiredRoomName = request.getParameter("roomName");
        //get the description of the room desired to create
        desiredRoomDescr = request.getParameter("roomDescr");
        ChatRoom room = new ChatRoom(chatRoomNumber,Integer.parseInt(request.getParameter("roomTipe")), desiredRoomName, desiredRoomDescr);
        /*
        Add New Room
        */
        out.print(desiredRoomName);
        out.print(desiredRoomDescr);
        out.print(chatRoomNumber);
        roomList.addRoom(room);
        application.setAttribute("roomList", roomList);
        //roomList = (ChatRoomList)application.getAttribute("roomList");
        //out.println(roomList.getRoom(room.getName()).getName());
        %>
    </body>
</html>
